Introduce efficient member functions for deleting waypoints (#1151)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sat, 5 Aug 2023 15:57:33 +0000 (09:57 -0600)
committerGitHub <noreply@github.com>
Sat, 5 Aug 2023 15:57:33 +0000 (09:57 -0600)
commit54c10cf2d8477d142c11129a8d13e6d314ae9658
tree4fe7851099a222f242ca594d8a67f110959f7f5c
parentba108534db81798d2284b1b5fb7f8d8566b9aefa
Introduce efficient member functions for deleting waypoints (#1151)

* Introduce efficient member functions for deleting waypoints

New functions with complexity O(n) for deleting pre-marked
waypoints are:
  WaypointList::del_wpts
  RouteList::del_wpts
  del_wpts
  route_del_wpts
  track_del_wpts

Use those functions instead of the inefficient versions
WaypointList::waypt_del
RouteList::del_wpt
waypt_del
route_del_wpt
track_del_wpt.
When these functions are using while looping over a waypoint list
the overall complexity is O(n^2).  This is because these functions
themselves amortize to O(n).

* review nits.

* tweak deletes

* use dedicated wpt deletion flag.
16 files changed:
arcdist.cc
arcdist.h
defs.h
discard.cc
discard.h
duplicate.cc
polygon.cc
polygon.h
position.cc
position.h
radius.cc
radius.h
route.cc
smplrout.cc
smplrout.h
waypt.cc